<?php

Class PgActiveRecord
{
	function Connection()
	{
		static $pg_rsc;
		
		$dbname = "guestbook";
		$dbuser = "postgres";
		$dbhost = "localhost";
		$dbport = "5432";
		$dbpass = "genpass";
		$pg_rsc = pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass");
		return $pg_rsc;
	}
	
	function Query($sql)
	{	
		return  pg_query(PgActiveRecord::Connection(), $sql);		
	}

}

?>